/**
 * 
 */
package com.taobao.wolfwolf.taobao;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		URL url = null;
		HttpURLConnection connection = null;
		try {
			String authcode = "TOP-1030b1b17631cca8ea6d22a764c2028cc350SON48178fbzbk405MeCntWxUrH5Z-END";
			String a = "http://container.open.taobao.com/container?authcode=" + authcode;
			String b = "http://my.open.taobao.com/auth/authorize.htm?appkey=12383292&encode=utf-8";
			url = new URL(a);
			connection = (HttpURLConnection) url.openConnection();
			connection.setDoOutput(true);
			connection.setDoInput(true);
			connection.setRequestMethod("GET");
			connection.setUseCaches(false);
			connection.connect();

			BufferedReader reader = new BufferedReader(new InputStreamReader(connection
					.getInputStream(), "utf-8"));
			StringBuffer buffer = new StringBuffer();
			String line = "";
			while ((line = reader.readLine()) != null) {
				buffer.append(line);
			}
			reader.close();
			System.out.println(buffer.toString());
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (connection != null) {
				connection.disconnect();
			}
		}
	}

}
